<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="shiro" uri="http://shiro.apache.org/tags" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>往来单位</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" href="/static/layui/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/layui/css/public.css" media="all" />
</head>
<body class="childrenBody">
<form class="layui-form">
    <blockquote class="layui-elem-quote quoteBox">
        <form class="layui-form">
            <div class="layui-inline">
                <div class="layui-input-inline">
                    <input type="text" class="layui-input searchVal" id="remindplate" placeholder="请输入车牌号" />
                </div>

                <div class="layui-input-block layui-inline">
                    <select id="status" lay-verify="required">
                        <option value="">请选择状态</option>
                        <option value="0">已过期</option>
                        <option value="1">即将过期</option>
                    </select>
                </div>

                <div class="layui-input-block layui-inline">
                    <select id="rtypeSearch" lay-verify="required">
                        <option value="">请选择提醒种类</option>
                    </select>
                </div>

                <a class="layui-btn search_btn" data-type="reload"  id="searchVal">搜索</a>
            </div>



        </form>
    </blockquote>

    <table id="remindList" lay-filter="remindList"></table>
    <!--操作-->
    <script type="text/html" id="btypeListBar"></script>
</form>
<script type="text/javascript" src="/static/layui/layui/layui.js"></script>
<script>
    layui.use(['form','layer','laydate','table','laytpl'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            $ = layui.jquery,
            laytpl = layui.laytpl,
            table = layui.table,
            laydate=layui.laydate;

        //用户列表
        var tableIns = table.render({
            elem: '#remindList',
            url : '/remind/list',
            cellMinWidth : 95,
            page : true,
            height : "full-125",
            limits : [5,10,15,20,25],
            limit : 5,
            id : "remindListTable",
            cols : [[
                {type: "checkbox", fixed:"left", width:50},
                {field: 'remindplate', title: '车牌号', minWidth:100, align:"center"},

                {field: 'remindtime', title: '到期时间',minWidth:110, align:'center'},

                {field: 'rtype', title: '提醒种类', minWidth:100, align:'center',templet:function (d) {

                    return d.rtype.rtype;
                }},
                {field: 'status', title: '状态', minWidth:100, align:'center',templet:function (d) {

                    return d.status==1?"未过期":"已过期";
                }}

            ]]
            ,done: function (res, curr, count) {
                for (var i=0;i<res.data.length;i++)   //遍历返回数据
                {
                    if(res.data[i].status==0)    //设置条件
                    {
                        $("table tbody tr").eq(i).css('color','red')    //改变满足条件行的颜色
                    }
                }
            }
        });
        //搜索
        $("#searchVal").click(function () {
            var remindplate=$('#remindplate').val();
            var rtypeid=$('#rtypeSearch').val();
            var status=$('#status').val();
            tableIns.reload({
                where:{
                    remindplate:remindplate,
                    rtypeid:rtypeid,
                    status:status
                }
            })
        })

        //获取rtype数据
        $.ajax({
            url:"/remind/selectRtype",
            success:function (res) {
                for(var i=0;i<res.length;i++){
                    var op=$("<option></option>");
                    op.attr('value',res[i].rtypeid);
                    op.append(res[i].rtype);
                    $("#rtypeSearch").append(op);
                }
                form.render('select');
            }
        });
    })

</script>
</body>
</html>
